<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Title</title>
  </head>
  <body>
    <!--void-->
    <a href="javascript:void(0)">链接</a><!--什么都不会发生-->
    <a href="javascript:void(document.form.submit())">链接</a><!--提交表单-->
  </body>

  <script>
      /*typeof*/
      console.log(typeof 10);//number
      console.log(typeof 'hhh');//string
      console.log(typeof true);//boolean
      console.log(typeof null);//object
      console.log(typeof undefined);//undefined
      console.log(typeof new Function('1+2'));//function
      console.log(typeof [10, 20, 30]);//object
      console.log(typeof document.lastModified);//string
      console.log(typeof window.length);//number


      /*instanceof*/
      console.log(10 instanceof Number);//false
      console.log(new Number(10) instanceof Number);//true
      console.log('hh' instanceof String);//false
      console.log(new String('hh') instanceof String);//true
      console.log([10, 20, 30] instanceof Array);//true


      /*in*/
      var obj = {
          name: 'chen',
          age: 12,
      }
      console.log(name in obj);//false
      console.log('name' in obj);//true(键名需为字符串字面量)
      console.log('chen' in obj);//false
      for (let item in obj) {
          console.log(item)//name，age
      }

      var arr = ['hh', 'xx', 'ss'];
      console.log(0 in arr);//ture
      console.log(4 in arr);//false
      console.log('hh' in arr);//false
      console.log('length' in arr);//true
      for (let item in ['hh', 'xx', 'ss']) {
          console.log(item)//0，1，2
      }


      /*of*/
      /*var obj = {
          name: 'chen',
          age: 12,
      }
      for (let item of obj) {
          console.log(item)//Uncaught TypeError: obj is not iterable
      }*/

      for (let item of ['hh', 'xx', 'ss']) {
          console.log(item)//hh，xx，ss
      }


      /*delete*/
      del_temp = 10;
      console.log(del_temp);//10
      console.log(delete del_temp);//true
      //console.log(del_temp);//del_temp is not defined

      obj = {
          name: 'chen',
          age: 20,
      }
      console.log(obj);//{ "name": "chen", "age": 20 }
      console.log(delete obj.name);//true
      console.log(obj);//{ "age": 20 }

      arr = [10, 20, 30];
      console.log(arr);//[10,20,30]
      console.log(delete arr[1]);//true
      console.log(arr);//[10,undefine,30]

      var del_var = 10;
      console.log(del_var);//10
      console.log(delete del_var);//false(被var、let和const声明的变量不能被delete删除)
      console.log(del_var);//10

      let del_let = 10;
      console.log(del_let);//10
      console.log(delete del_let);//false(被var、let和const声明的变量不能被delete删除)
      console.log(del_let);//10

      const del_const = 10;
      console.log(del_const);//10
      console.log(delete del_const);//false(被var、let和const声明的变量不能被delete删除)
      console.log(del_const);//10

      console.log(delete Math.PI);//false(预定义属性不能被delete删除)


      /*...*/
      var arr = [11, 22, 33];
      console.log([...arr, 44, 55]);//[11, 22, 33, 44, 55]

      function func1(x, y, z) {
          console.log(x + ',' + y + ',' + z);//0,1,2
      }
      var args = [0, 1, 2];
      func1(...args);

      function func2(...rest){
          console.log(rest);//[1, 2, 3]
      }
      func2(1,2,3)
  </script>
</html>